3.15 \(\int \cot ^4(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=117 \[ -\frac {a^2 (3 B+4 i A) \cot ^2(c+d x)}{6 d}+\frac {2 a^2 (A-i B) \cot (c+d x)}{d}-\frac {2 a^2 (B+i A) \log (\sin (c+d x))}{d}+2 a^2 x (A-i B)-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d} \]

[Out]

2*a^2*(A-I*B)*x+2*a^2*(A-I*B)*cot(d*x+c)/d-1/6*a^2*(4*I*A+3*B)*cot(d*x+c)^2/d-2*a^2*(I*A+B)*ln(sin(d*x+c))/d-1
/3*A*cot(d*x+c)^3*(a^2+I*a^2*tan(d*x+c))/d

________________________________________________________________________________________

Rubi [A]  time = 0.26, antiderivative size = 117, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3593, 3591, 3529, 3531, 3475} \[ -\frac {a^2 (3 B+4 i A) \cot ^2(c+d x)}{6 d}+\frac {2 a^2 (A-i B) \cot (c+d x)}{d}-\frac {2 a^2 (B+i A) \log (\sin (c+d x))}{d}+2 a^2 x (A-i B)-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

2*a^2*(A - I*B)*x + (2*a^2*(A - I*B)*Cot[c + d*x])/d - (a^2*((4*I)*A + 3*B)*Cot[c + d*x]^2)/(6*d) - (2*a^2*(I*
A + B)*Log[Sin[c + d*x]])/d - (A*Cot[c + d*x]^3*(a^2 + I*a^2*Tan[c + d*x]))/(3*d)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3591

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((b*c - a*d)*(A*b - a*B)*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2
 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*
c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rule 3593

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[(a^2*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^
(n + 1))/(d*f*(b*c + a*d)*(n + 1)), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c +
 d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m -
 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && EqQ
[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rubi steps

\begin {align*} \int \cot ^4(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d}+\frac {1}{3} \int \cot ^3(c+d x) (a+i a \tan (c+d x)) (a (4 i A+3 B)-a (2 A-3 i B) \tan (c+d x)) \, dx\\ &=-\frac {a^2 (4 i A+3 B) \cot ^2(c+d x)}{6 d}-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d}+\frac {1}{3} \int \cot ^2(c+d x) \left (-6 a^2 (A-i B)-6 a^2 (i A+B) \tan (c+d x)\right ) \, dx\\ &=\frac {2 a^2 (A-i B) \cot (c+d x)}{d}-\frac {a^2 (4 i A+3 B) \cot ^2(c+d x)}{6 d}-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d}+\frac {1}{3} \int \cot (c+d x) \left (-6 a^2 (i A+B)+6 a^2 (A-i B) \tan (c+d x)\right ) \, dx\\ &=2 a^2 (A-i B) x+\frac {2 a^2 (A-i B) \cot (c+d x)}{d}-\frac {a^2 (4 i A+3 B) \cot ^2(c+d x)}{6 d}-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d}-\left (2 a^2 (i A+B)\right ) \int \cot (c+d x) \, dx\\ &=2 a^2 (A-i B) x+\frac {2 a^2 (A-i B) \cot (c+d x)}{d}-\frac {a^2 (4 i A+3 B) \cot ^2(c+d x)}{6 d}-\frac {2 a^2 (i A+B) \log (\sin (c+d x))}{d}-\frac {A \cot ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 3.87, size = 435, normalized size = 3.72 \[ \frac {a^2 \csc (c) \csc ^3(c+d x) (\cos (2 d x)+i \sin (2 d x)) \left (-48 (A-i B) \sin (c) \sin ^3(c+d x) \tan ^{-1}(\tan (3 c+d x))+3 \cos (d x) \left ((-3 B-3 i A) \log \left (\sin ^2(c+d x)\right )+4 A (3 d x-i)+2 B (-1-6 i d x)\right )-18 A \sin (2 c+d x)+14 A \sin (2 c+3 d x)+12 i A \cos (2 c+d x)-36 A d x \cos (2 c+d x)-12 A d x \cos (2 c+3 d x)+12 A d x \cos (4 c+3 d x)+9 i A \cos (2 c+d x) \log \left (\sin ^2(c+d x)\right )+3 i A \cos (2 c+3 d x) \log \left (\sin ^2(c+d x)\right )-3 i A \cos (4 c+3 d x) \log \left (\sin ^2(c+d x)\right )-24 A \sin (d x)+12 i B \sin (2 c+d x)-12 i B \sin (2 c+3 d x)+6 B \cos (2 c+d x)+36 i B d x \cos (2 c+d x)+12 i B d x \cos (2 c+3 d x)-12 i B d x \cos (4 c+3 d x)+9 B \cos (2 c+d x) \log \left (\sin ^2(c+d x)\right )+3 B \cos (2 c+3 d x) \log \left (\sin ^2(c+d x)\right )-3 B \cos (4 c+3 d x) \log \left (\sin ^2(c+d x)\right )+24 i B \sin (d x)\right )}{24 d (\cos (d x)+i \sin (d x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(a^2*Csc[c]*Csc[c + d*x]^3*(Cos[2*d*x] + I*Sin[2*d*x])*((12*I)*A*Cos[2*c + d*x] + 6*B*Cos[2*c + d*x] - 36*A*d*
x*Cos[2*c + d*x] + (36*I)*B*d*x*Cos[2*c + d*x] - 12*A*d*x*Cos[2*c + 3*d*x] + (12*I)*B*d*x*Cos[2*c + 3*d*x] + 1
2*A*d*x*Cos[4*c + 3*d*x] - (12*I)*B*d*x*Cos[4*c + 3*d*x] + (9*I)*A*Cos[2*c + d*x]*Log[Sin[c + d*x]^2] + 9*B*Co
s[2*c + d*x]*Log[Sin[c + d*x]^2] + (3*I)*A*Cos[2*c + 3*d*x]*Log[Sin[c + d*x]^2] + 3*B*Cos[2*c + 3*d*x]*Log[Sin
[c + d*x]^2] - (3*I)*A*Cos[4*c + 3*d*x]*Log[Sin[c + d*x]^2] - 3*B*Cos[4*c + 3*d*x]*Log[Sin[c + d*x]^2] + 3*Cos
[d*x]*(2*B*(-1 - (6*I)*d*x) + 4*A*(-I + 3*d*x) + ((-3*I)*A - 3*B)*Log[Sin[c + d*x]^2]) - 24*A*Sin[d*x] + (24*I
)*B*Sin[d*x] - 48*(A - I*B)*ArcTan[Tan[3*c + d*x]]*Sin[c]*Sin[c + d*x]^3 - 18*A*Sin[2*c + d*x] + (12*I)*B*Sin[
2*c + d*x] + 14*A*Sin[2*c + 3*d*x] - (12*I)*B*Sin[2*c + 3*d*x]))/(24*d*(Cos[d*x] + I*Sin[d*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.55, size = 180, normalized size = 1.54 \[ \frac {{\left (30 i \, A + 18 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-36 i \, A - 30 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (14 i \, A + 12 \, B\right )} a^{2} + {\left ({\left (-6 i \, A - 6 \, B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (18 i \, A + 18 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-18 i \, A - 18 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (6 i \, A + 6 \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/3*((30*I*A + 18*B)*a^2*e^(4*I*d*x + 4*I*c) + (-36*I*A - 30*B)*a^2*e^(2*I*d*x + 2*I*c) + (14*I*A + 12*B)*a^2
+ ((-6*I*A - 6*B)*a^2*e^(6*I*d*x + 6*I*c) + (18*I*A + 18*B)*a^2*e^(4*I*d*x + 4*I*c) + (-18*I*A - 18*B)*a^2*e^(
2*I*d*x + 2*I*c) + (6*I*A + 6*B)*a^2)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*I*c) - 3*d*e^(4*I*d*x +
4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) - d)

________________________________________________________________________________________

giac [B]  time = 2.10, size = 255, normalized size = 2.18 \[ \frac {A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 i \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 27 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 i \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 48 \, {\left (2 i \, A a^{2} + 2 \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) + 48 \, {\left (-i \, A a^{2} - B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - \frac {-88 i \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 88 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 27 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 24 i \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 6 i \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(A*a^2*tan(1/2*d*x + 1/2*c)^3 - 6*I*A*a^2*tan(1/2*d*x + 1/2*c)^2 - 3*B*a^2*tan(1/2*d*x + 1/2*c)^2 - 27*A*
a^2*tan(1/2*d*x + 1/2*c) + 24*I*B*a^2*tan(1/2*d*x + 1/2*c) + 48*(2*I*A*a^2 + 2*B*a^2)*log(tan(1/2*d*x + 1/2*c)
 + I) + 48*(-I*A*a^2 - B*a^2)*log(tan(1/2*d*x + 1/2*c)) - (-88*I*A*a^2*tan(1/2*d*x + 1/2*c)^3 - 88*B*a^2*tan(1
/2*d*x + 1/2*c)^3 - 27*A*a^2*tan(1/2*d*x + 1/2*c)^2 + 24*I*B*a^2*tan(1/2*d*x + 1/2*c)^2 + 6*I*A*a^2*tan(1/2*d*
x + 1/2*c) + 3*B*a^2*tan(1/2*d*x + 1/2*c) + A*a^2)/tan(1/2*d*x + 1/2*c)^3)/d

________________________________________________________________________________________

maple [A]  time = 0.42, size = 154, normalized size = 1.32 \[ 2 a^{2} A x +\frac {2 a^{2} A \cot \left (d x +c \right )}{d}+\frac {2 A \,a^{2} c}{d}-\frac {2 a^{2} B \ln \left (\sin \left (d x +c \right )\right )}{d}-\frac {i A \,a^{2} \left (\cot ^{2}\left (d x +c \right )\right )}{d}-\frac {2 i A \,a^{2} \ln \left (\sin \left (d x +c \right )\right )}{d}-2 i B \,a^{2} x -\frac {2 i B \cot \left (d x +c \right ) a^{2}}{d}-\frac {2 i B \,a^{2} c}{d}-\frac {a^{2} A \left (\cot ^{3}\left (d x +c \right )\right )}{3 d}-\frac {a^{2} B \left (\cot ^{2}\left (d x +c \right )\right )}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)

[Out]

2*a^2*A*x+2*a^2*A*cot(d*x+c)/d+2/d*A*a^2*c-2/d*a^2*B*ln(sin(d*x+c))-I/d*A*a^2*cot(d*x+c)^2-2*I/d*A*a^2*ln(sin(
d*x+c))-2*I*B*x*a^2-2*I/d*B*cot(d*x+c)*a^2-2*I/d*B*a^2*c-1/3*a^2*A*cot(d*x+c)^3/d-1/2/d*a^2*B*cot(d*x+c)^2

________________________________________________________________________________________

maxima [A]  time = 0.78, size = 113, normalized size = 0.97 \[ \frac {12 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{2} + 6 \, {\left (i \, A + B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (-2 i \, A - 2 \, B\right )} a^{2} \log \left (\tan \left (d x + c\right )\right ) + \frac {12 \, {\left (A - i \, B\right )} a^{2} \tan \left (d x + c\right )^{2} - {\left (6 i \, A + 3 \, B\right )} a^{2} \tan \left (d x + c\right ) - 2 \, A a^{2}}{\tan \left (d x + c\right )^{3}}}{6 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(12*(d*x + c)*(A - I*B)*a^2 + 6*(I*A + B)*a^2*log(tan(d*x + c)^2 + 1) + 6*(-2*I*A - 2*B)*a^2*log(tan(d*x +
 c)) + (12*(A - I*B)*a^2*tan(d*x + c)^2 - (6*I*A + 3*B)*a^2*tan(d*x + c) - 2*A*a^2)/tan(d*x + c)^3)/d

________________________________________________________________________________________

mupad [B]  time = 6.28, size = 93, normalized size = 0.79 \[ -\frac {\frac {A\,a^2}{3}-{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (2\,A\,a^2-B\,a^2\,2{}\mathrm {i}\right )+\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {B\,a^2}{2}+A\,a^2\,1{}\mathrm {i}\right )}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3}-\frac {a^2\,\mathrm {atan}\left (2\,\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,4{}\mathrm {i}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^4*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^2,x)

[Out]

- ((A*a^2)/3 - tan(c + d*x)^2*(2*A*a^2 - B*a^2*2i) + tan(c + d*x)*(A*a^2*1i + (B*a^2)/2))/(d*tan(c + d*x)^3) -
 (a^2*atan(2*tan(c + d*x) + 1i)*(A*1i + B)*4i)/d

________________________________________________________________________________________

sympy [A]  time = 2.36, size = 182, normalized size = 1.56 \[ - \frac {2 i a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac {- 14 i A a^{2} - 12 B a^{2} + \left (36 i A a^{2} e^{2 i c} + 30 B a^{2} e^{2 i c}\right ) e^{2 i d x} + \left (- 30 i A a^{2} e^{4 i c} - 18 B a^{2} e^{4 i c}\right ) e^{4 i d x}}{- 3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} - 9 d e^{2 i c} e^{2 i d x} + 3 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)

[Out]

-2*I*a**2*(A - I*B)*log(exp(2*I*d*x) - exp(-2*I*c))/d + (-14*I*A*a**2 - 12*B*a**2 + (36*I*A*a**2*exp(2*I*c) +
30*B*a**2*exp(2*I*c))*exp(2*I*d*x) + (-30*I*A*a**2*exp(4*I*c) - 18*B*a**2*exp(4*I*c))*exp(4*I*d*x))/(-3*d*exp(
6*I*c)*exp(6*I*d*x) + 9*d*exp(4*I*c)*exp(4*I*d*x) - 9*d*exp(2*I*c)*exp(2*I*d*x) + 3*d)

________________________________________________________________________________________